﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace TriangleGame
{
    

    public class Punto:System.Object
    {
        private int cordX;
        private int cordY;
        
        public Punto(int x, int y){
            cordX = x;
            cordY = y;
        }

        public int getX() { return cordX; }
        public int getY() { return cordY; }
        /*
        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;
            // If parameter cannot be cast to Point return false.
            Punto p = obj as Punto;
            if ((System.Object)p == null)
            {
                return false;
            }
            // Return true if the fields match:
            return (cordX == p.cordX) && (cordY == p.cordY);
        }
        */
        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;
            if (this.GetType() == obj.GetType())
                return Equals((Punto)obj);
            else
                return false;
        }

        public bool Equals(Punto p)
        {
            if (p == null)
                return false;
            else return ((cordX == p.getX()) && (cordY == p.getY()));
        }


        public override int GetHashCode()
        {
            return cordX * cordY;
        }

        public double CalcolaAlfa(Punto B) 
        {
            int dx = cordY - B.getY();
            int dy = cordX-B.getX();
            double rad = Math.Atan2(dx,dy);//e se usiamo Acotang?
            return (rad * (180.0 / Math.PI) + 180) % 360;
        }//CalcolaAlfa

        public double CalcolaDistanza(Punto B)
        {
            double a = B.getX() - cordX;
            double b = B.getY() - cordY;
            return Math.Sqrt(a*a + b*b);
        }//CalcolaDistanza

    }//class Punto

    
}
